package online.hxstar.cloud.web;

import lombok.extern.slf4j.Slf4j;
import online.hxstar.cloud.web.annotation.UrlRegistered;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author xinghu
 * @date 2019/9/5 6:27 下午
 */
@RestController
@RequestMapping("/config")
@RefreshScope
@Slf4j
public class ConfigController {

	@Value("${useLocalCache:false}")
	private boolean useLocalCache;

	@RequestMapping("/get")
	public boolean get() {
		return useLocalCache;
	}

	@PostMapping(value = "/post")
	@UrlRegistered(flag = "testFlag")
	public Object postTest(@RequestBody Map<String, String> data) {
		return data;
	}
}